<script>
	var url;
	$(document).ready(function(){
		
		exportPDF = function(val){
			//var kd_fakultas = $('#s_kd_fakultas').val();
			//var kd_prodi = $('#s_kd_prodi').val();
			//var tahun = $('#s_tahun').val();
			//var nim = $('#nim').combogrid('getValue');
			window.open('<?=base_url().'ijazah/laporan_pdf/'?>'+val);
			//$('#dg').datagrid('enableFilter');
		}
		
		printData = function (val){
			//var row = $('#dg').datagrid('getSelected');
			//if (row){
				$('#dialog').dialog({
					title: 'Edit Data Alumni',
					width: 400,
					height: 275,
					closed: true,
					cache: false,
					href: base_url+'alumni/edit/'+val,
					modal: true
				});
				
				$('#dialog').dialog('open');  
				url = base_url+'alumni/save/edit';
			//}
		}
		//end saveData
		
		actionbutton = function(value, row, index){
			var col;
				<?if($this->mdl_auth->CekAkses(array('menu_id'=>53, 'policy'=>'PRINT'))){?>
				col = '<a href="#" onclick="exportPDF(\''+row.kd_mahasiswa+'\');" class="easyui-linkbutton" iconCls="icon-print" plain="false">Cetak</a>';
				<?}?>
			return col;
		}
		
		// load grid
		$(function(){
			$('#dg').datagrid({url:"<?=base_url()?>ijazah/grid"});	
			//$('#dg').datagrid('enableFilter'); 			
		});	
		
		// onchange
		$('#s_kd_fakultas').change(function(){
			$('#s_kd_prodi').load(base_url+'prosedur/getProdibyFakultas/'+$('#s_kd_fakultas').val());
		});
		
		// filter
		filter = function(){
			$('#dg').datagrid('load',{
				kd_fakultas : $('#s_kd_fakultas').val(),
				kd_prodi : $('#s_kd_prodi').val(),
				tahun : $('#s_tahun').val(),
			});
			//$('#dg').datagrid('enableFilter');
		}
		
	});
</script>

<table id="dg" title="Cetak Ijazah Mahasiswa" data-options="
			rownumbers:true,
			singleSelect:true,
			autoRowHeight:false,
			pagination:true,
			pageSize:30,
			fit:true,
			toolbar:'#toolbar',
			">
	<thead>
		<tr>
			<!--<th field="tahun_penerimaan" sortable="true" width="80">Tahun Penerimaan</th> -->
			<th field="nim" sortable="true" width="125">NIM</th>
			<th field="nama" sortable="true" width="200">Nama Mahasiswa</th>
			<!--<th field="alamat" sortable="true" width="150">Alamat</th>-->
			<th field="thn_angkatan" sortable="true" width="100">Tahun Masuk</th>
			<th field="tahun_lulus" sortable="true" width="100">Tahun Lulus</th>
			<!--<th field="status_kerja" sortable="true" width="150">Status Pekerjaan</th>
			<th field="instansi" sortable="true" width="150">Instansi</th>-->
			<th field="action" align="center" formatter="actionbutton" width="100">Aksi</th>
		</tr>
	</thead>
</table>
<div id="toolbar" style="padding:5px;height:auto">
	<div style="margin-bottom:5px">
		
	</div>
	<div>
		<table width="700" border="0">
		  <tr>
			<td>Fakultas</td>
			<td>: 
				<select id="s_kd_fakultas" name="s_kd_fakultas" style="width:290px;">
					<?=$this->mdl_prosedur->OptionFakultas();?>
				</select>
			</td>
			<td>&nbsp;</td>
			<td>Tahun Angkatan</td>
			<td>: 
				<select id="s_tahun" name="s_tahun" style="width:100px;">
					<?=$this->mdl_prosedur->OptionTahunAngkatan();?>
				</select>
			</td>
		  </tr>
		  <tr>
			<td>Program Studi</td>
			<td>: 
				<select id="s_kd_prodi" name="s_kd_prodi" style="width:290px;">
					<?=$this->mdl_prosedur->OptionProdi();?>
				</select>
			</td>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>&nbsp;&nbsp;<a href="#" onclick="filter()" class="easyui-linkbutton" iconCls="icon-search">Filter</a></td>
		  </tr>
		</table>
	</div>
</div>
